﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;

namespace Mulala.Cavan.Presentation.Mvc
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "TwoID",
                url: "{controller}/{action}/{id1}/{id2}",
                defaults: new { controller = "ProprietorCenterController", action = "designatenanny", id1 = 1, id2 = 2 },
                constraints: new { id1 = @"([\d]+)", id2 = @"([\d]+)" }
            );

            routes.MapRoute(
                name: "DefaultList",
                url: "system/{controller}/{action}/{cp}",
                defaults: new { controller = "Corporation", action = "list", cp = 1 },
                constraints: new { cp = @"([\d]+)" }
            );

            routes.MapRoute(
                name: "SearchByConditions",
                url: "{area}/{controller}/{action}/cp{cp}_{conditions}",
                defaults: new { area = "tianhe", controller = "Corporation", action = "List", cp = 1, conditions = UrlParameter.Optional },
                constraints: new { area = @"([a-z]{1,20})", currentPage = @"([\d]+)", conditions = @"(([a-z]{1,2}\d+[-]{0,1})*)" }
            );

            routes.MapRoute(
                name: "Admin_Default",
                url: "Admin/{controller}/{action}/{id}",
                defaults: new { action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}